﻿<UserControl x:Class="F5.BigIp.LocalTrafficManager.UI.Views.MainMenuControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:F5.BigIp.LocalTrafficManager.UI.ViewModels"
             xmlns:extensions="clr-namespace:F5.BigIp.LocalTrafficManager.UI.Extensions"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.DataContext>
        <local:MainViewModel/>
    </UserControl.DataContext>

    <Menu>
        <MenuItem Header="_File">
            <MenuItem Header="_Exit" Command="{Binding ExitCommand}" />
        </MenuItem>

        <MenuItem Header="_Options">

            <MenuItem Header="_Always On Top" 
                      IsCheckable="True"
                      IsChecked="{Binding Path=Topmost, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}">
            </MenuItem>

            <Separator/>

            <MenuItem Header="_Hide Pools" IsCheckable="True" IsChecked="{Binding HidePools}"/>

        </MenuItem>

        <MenuItem Header="_View">

            <MenuItem Header="_Refresh Now" 
                      InputGestureText="F5" 
                      CommandParameter="{Binding SelectedPool}" 
                      Command="{Binding RefreshPoolMembersCommand}" />

            <MenuItem Header="_Update Speed">

                <MenuItem Header="_High" 
                          IsCheckable="True"
                          CommandParameter="1"
                          Command="{Binding SetUpdateSpeedCommand}" 
                          ToolTip="Refresh every 1 second"
                          extensions:MenuItemExtensions.GroupName="UpdateSpeed">
                    <MenuItem.Style>
                        <Style TargetType="MenuItem">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding UpdateSpeed}" Value="1">
                                    <Setter Property="IsChecked" Value="True"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </MenuItem.Style>
                </MenuItem>

                <MenuItem Header="_Normal"
                          IsCheckable="True"
                          CommandParameter="5" 
                          Command="{Binding SetUpdateSpeedCommand}" 
                          ToolTip="Refresh every 5 seconds"
                          extensions:MenuItemExtensions.GroupName="UpdateSpeed">
                    <MenuItem.Style>
                        <Style TargetType="MenuItem">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding UpdateSpeed}" Value="5">
                                    <Setter Property="IsChecked" Value="True"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </MenuItem.Style>
                </MenuItem>

                <MenuItem Header="_Low" 
                          IsCheckable="True"
                          CommandParameter="30" 
                          Command="{Binding SetUpdateSpeedCommand}" extensions:MenuItemExtensions.GroupName="UpdateSpeed"
                          ToolTip="Refresh every 30 seconds">
                    <MenuItem.Style>
                        <Style TargetType="MenuItem">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding UpdateSpeed}" Value="30">
                                    <Setter Property="IsChecked" Value="True"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </MenuItem.Style>
                </MenuItem>

            </MenuItem>

        </MenuItem>

    </Menu>

</UserControl>
